def save(model, filename):
    
    def traverse(tensor, f):
        for i in tensor:
            if len(i.shape) == 0:
                f.write(struct.pack(">f", (float)(i.data)))
            else:
                traverse(i, f)

    f = open(filename, 'wb')
    for _,param in enumerate(model.named_parameters()):
        traverse(param[1], f)
        print(str(param[0]))